package com.banksystem.mapper;

import java.util.List;

import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import com.banksystem.entity.News;

public interface Newsmapper {

	@Select("insert into news (title,gname,master,content,date) values (#{title},#{gname},#{master},#{content},#{date})")
	public void addnews(@Param("title")String title,@Param("gname")String gname,@Param("master")String master ,@Param("content")String content,@Param("date")String date);
	
	@Select("select * from news where gname=#{gname}")
	public List<News> findNewsAll(@Param("gname")String gname);
	
	@Select("select * from news ")
	public List<News> adminfindNewsAll();
	
	@Delete("delete from news where nid=#{nid}")
	public void deletenews(@Param("nid")String nid);
	
	@Select("select * from news where gname like'%${gname}%' and ( gname like'%${seach}%' or title like'%${seach}%' or nid like'%${seach}%' or content like'%${seach}%' )")
	public List<News> findNewsAlllike(@Param("seach")String seach,@Param("gname")String gname);
}
